package com.lei.day02lx;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.lei.day02lx.mvp.Contract;
import com.lei.day02lx.mvp.Model;
import com.lei.day02lx.mvp.Presenter;
import com.lei.day02lx.network.NetWorkManager;
import com.lei.day02lx.network.schedulers.SchedulerProvider;

public class MainActivity extends AppCompatActivity implements Contract.View {
    private Presenter presenter;
    private TextView text;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        NetWorkManager.getInstance().init();
        setContentView(R.layout.activity_main);
        text = (TextView) findViewById(R.id.text);
        presenter = new Presenter(new Model(),this, SchedulerProvider.getInstance());
        text.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                presenter.getCarList();
            }
        });
    }

    @Override
    public void getDataSuccess(String url) {
        //请求成功之后View的反馈
        Log.e("ljl", "getDataSuccess: "+"请求成功"+url);
    }

    @Override
    public void getDataFailed() {
        //请求失败之后View的反馈
    }
}
